<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<a th:if="${flag == 'yes'}" th:href="@{http://www.baidu.com}">百度</a>
<a th:unless="${flag == 'yes'}" th:href="@{http://www.qq.com}">腾讯</a>
</body>
</html>